<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>download status</title>
<script type="text/javascript" src="{{env('JS_DOMAIN')}}js/jquery.min.js"></script>
{{--<script src="{{env('JS_DOMAIN')}}js/bootstrap/js/bootstrap.min.js"></script>  --}}
</head>
<script type="text/javascript">
    $().click(function() {
        var percentage = 0;
        var contentwidth = percentage*100;
        $("#content").css("width",contentwidth);
        //定时请求刷新
        var settime = setInterval(runajax,5000);
    });
    //ajax方法执行
    function runajax(){
        $.ajax({
            "url":"/console/",
            "dataType":"json",
            "type":"post",
            "async":"true"
        }).success(function(data){
            var percentage=data.percentage;
            var contentwidth=percentage*100;
            //css用来设置style里面的属性，attr用来设置元素的属性值
            $("#content").css("width",contentwidth);
            if(percentage == 100) {
                clearInterval(settime);
            }
        }).error();
    }
</script>
<body>
    <div id="progressbar" style="width:100px;height:20px;border:2px solid black" >
        <div id="content" style="height:20px;background:yellow"></div>
    </div>
</body>
</html>